<template>
	<view class="container">
		<view class="company margin32 hasMore">
			<view class="top flexBetween">
				<view class="title">
					我的分销公司
				</view>
				<view
					class="more flexCenter"
					@tap="goCompany"
					v-if="comList&&comList.length>0"
				>
					查看更多
					<image
						src="@/static/images/icon/right.png"
						mode=""
					></image>
				</view>

			</view>
			<view
				class="noMore"
				v-if="!comList.length>0"
			>
				暂无更多
			</view>
			<Compony
				v-for="item,index in comList"
				:key="index"
				:list="item"
			></Compony>
		</view>
		<view class="order margin32 hasMore">
			<view class="top flexBetween">
				<view class="title">
					分销订单
				</view>
				<view
					class="more flexCenter"
					@tap="goOrder"
					v-if="orderList&&orderList.length>0"
				>
					查看更多
					<image
						src="@/static/images/icon/right.png"
						mode=""
					></image>
				</view>
			</view>
			<view
				class="noMore"
				v-if="!orderList.length>0"
			>
				暂无更多
			</view>
			<Order
				v-for="item,index in orderList"
				:key="index"
				:list="item"
			></Order>
		</view>
	</view>
</template>

<script>
import Compony from "@/pages/components/compony/compony.vue"
import Order from "@/pages/components/order/order.vue"
import mixins from "@/mixins/mixins.js"
import {
	Home
} from '@/config/API.js'
export default {
	components: {
		Compony,
		Order
	},
	mixins: [mixins],
	data () {
		return {
			form: {
				limit: 3,
				page: 1
			},
			orderList: [],
			comList: []
		};
	},
	methods: {
		clear () {
			this.form.page = 1
		},
		init () {
			Home.indexFenxiao(this.form).then(res => {
				uni.stopPullDownRefresh()
				this.orderList = res.data.items
			})
			Home.indexCompany(this.form).then(res => {
				uni.stopPullDownRefresh()
				this.comList = res.data.items
			})
		},
		goOrder () {
			uni.navigateTo({
				url: "/pages/home/order/order"
			})
		},
		goCompany () {
			uni.navigateTo({
				url: "/pages/home/company/company"
			})
		}
	}
}
</script>
<style>
page {
	background-color: #f4f6f8;
}
</style>
<style lang="scss" scoped>
.noMore {
	width: 100%;
	height: 400rpx;
	line-height: 400rpx;
	text-align: center;
	font-size: 30rpx;
	color: #999999;
}
/* 查看更多 */
.hasMore {
	.top {
		margin-bottom: 24rpx;

		.title {
			font-size: 34rpx;
			font-family: PingFang SC-Bold, PingFang SC;
			font-weight: bold;
			color: #333333;
		}

		.more {
			font-size: 28rpx;
			font-family: PingFang SC-Medium, PingFang SC;
			font-weight: 500;
			color: #999999;

			image {
				width: 10rpx;
				height: 20rpx;
				margin-left: 10rpx;
			}
		}
	}
}

.company {
	margin-top: 34rpx;
}
</style>